package com.vimi8.ebb.auth.model;

import java.util.Collection;
import java.util.Objects;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.security.core.GrantedAuthority;

import java.util.ArrayList;


/**
 * 验证用户的信息,可选择需实现org.springframework.security.core.userdetails.UserDetails接口.
 **/

/**
 * 验证用户的信息,可选择需实现org.springframework.security.core.userdetails.UserDetails接口.
 */
@ApiModel(description = "验证用户的信息,可选择需实现org.springframework.security.core.userdetails.UserDetails接口.")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringCodegen", date = "2016-09-17T13:45:41.305Z")

public class DBUserDetails implements org.springframework.security.core.userdetails.UserDetails   {
  private String username = null;

  private String password = null;

  private String authCode = null;

  private Collection<? extends GrantedAuthority> authorities = new ArrayList<GrantedAuthority>();

  private boolean accountNonExpired = true;

  private boolean accountNonLocked = true;

  private boolean credentialsNonExpired = true;

  private boolean enabled = true;

  public DBUserDetails username(String username) {
    this.username = username;
    return this;
  }

   /**
   * 被验证的用户名(与登录名称相同,手机号,身份证等具备唯一标识的内容).
   * @return username
  **/
  @ApiModelProperty(value = "被验证的用户名(与登录名称相同,手机号,身份证等具备唯一标识的内容).")
  public String getUsername() {
    return username;
  }

  public void setUsername(String username) {
    this.username = username;
  }

  public DBUserDetails password(String password) {
    this.password = password;
    return this;
  }

   /**
   * 被验证的用户密码(与登录密码相同,密码等只有用户可知的内容).
   * @return password
  **/
  @ApiModelProperty(value = "被验证的用户密码(与登录密码相同,密码等只有用户可知的内容).")
  public String getPassword() {
    return password;
  }

  public void setPassword(String password) {
    this.password = password;
  }

  public DBUserDetails authCode(String authCode) {
    this.authCode = authCode;
    return this;
  }

   /**
   * 被验证的手机验证码(与登录密码相同,验证码等只有用户可知的内容).
   * @return authCode
  **/
  @ApiModelProperty(value = "被验证的手机验证码(与登录密码相同,验证码等只有用户可知的内容).")
  public String getAuthCode() {
    return authCode;
  }

  public void setAuthCode(String authCode) {
    this.authCode = authCode;
  }

   /**
   * 被验证的用户权限(不使用此字段,权限应该更客户端和相关).
   * @return authorities
  **/
  @ApiModelProperty(value = "被验证的用户权限(不使用此字段,权限应该更客户端和相关).")
  public Collection<? extends GrantedAuthority> getAuthorities() {
    return authorities;
  }

  public void setAuthorities(Collection<? extends GrantedAuthority> authorities) {
    this.authorities = authorities;
  }

  public DBUserDetails accountNonExpired(boolean accountNonExpired) {
    this.accountNonExpired = accountNonExpired;
    return this;
  }

   /**
   * 账户未过期.
   * @return accountNonExpired
  **/
  @ApiModelProperty(value = "账户未过期.")
  public boolean isAccountNonExpired() {
    return accountNonExpired;
  }

  public void setAccountNonExpired(boolean accountNonExpired) {
    this.accountNonExpired = accountNonExpired;
  }

  public DBUserDetails accountNonLocked(boolean accountNonLocked) {
    this.accountNonLocked = accountNonLocked;
    return this;
  }

   /**
   * 账户未锁定.
   * @return accountNonLocked
  **/
  @ApiModelProperty(value = "账户未锁定.")
  public boolean isAccountNonLocked() {
    return accountNonLocked;
  }

  public void setAccountNonLocked(boolean accountNonLocked) {
    this.accountNonLocked = accountNonLocked;
  }

  public DBUserDetails credentialsNonExpired(boolean credentialsNonExpired) {
    this.credentialsNonExpired = credentialsNonExpired;
    return this;
  }

   /**
   * 密钥未过期.
   * @return credentialsNonExpired
  **/
  @ApiModelProperty(value = "密钥未过期.")
  public boolean isCredentialsNonExpired() {
    return credentialsNonExpired;
  }

  public void setCredentialsNonExpired(Boolean credentialsNonExpired) {
    this.credentialsNonExpired = credentialsNonExpired;
  }

  public DBUserDetails enabled(boolean enabled) {
    this.enabled = enabled;
    return this;
  }

   /**
   * 账号可用.
   * @return enabled
  **/
  @ApiModelProperty(value = "账号可用.")
  public boolean isEnabled() {
    return enabled;
  }

  public void setEnabled(boolean enabled) {
    this.enabled = enabled;
  }


  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    DBUserDetails dBUserDetails = (DBUserDetails) o;
    return Objects.equals(this.username, dBUserDetails.username) &&
        Objects.equals(this.password, dBUserDetails.password) &&
        Objects.equals(this.authCode, dBUserDetails.authCode) &&
        Objects.equals(this.authorities, dBUserDetails.authorities) &&
        Objects.equals(this.accountNonExpired, dBUserDetails.accountNonExpired) &&
        Objects.equals(this.accountNonLocked, dBUserDetails.accountNonLocked) &&
        Objects.equals(this.credentialsNonExpired, dBUserDetails.credentialsNonExpired) &&
        Objects.equals(this.enabled, dBUserDetails.enabled);
  }

  @Override
  public int hashCode() {
    return Objects.hash(username, password, authCode, authorities, accountNonExpired, accountNonLocked, credentialsNonExpired, enabled);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class DBUserDetails {\n");
    
    sb.append("    username: ").append(toIndentedString(username)).append("\n");
    sb.append("    password: ").append(toIndentedString(password)).append("\n");
    sb.append("    authCode: ").append(toIndentedString(authCode)).append("\n");
    sb.append("    authorities: ").append(toIndentedString(authorities)).append("\n");
    sb.append("    accountNonExpired: ").append(toIndentedString(accountNonExpired)).append("\n");
    sb.append("    accountNonLocked: ").append(toIndentedString(accountNonLocked)).append("\n");
    sb.append("    credentialsNonExpired: ").append(toIndentedString(credentialsNonExpired)).append("\n");
    sb.append("    enabled: ").append(toIndentedString(enabled)).append("\n");
    sb.append("}");
    return sb.toString();
  }

  /**
   * Convert the given object to string with each line indented by 4 spaces
   * (except the first line).
   */
  private String toIndentedString(Object o) {
    if (o == null) {
      return "null";
    }
    return o.toString().replace("\n", "\n    ");
  }
}

